package org.goodev.taskstackbuilder;

import android.app.Activity;
import android.app.TaskStackBuilder;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class Main extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		findViewById(R.id.main).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				startActivity(new Intent(getApplicationContext(), GoodevItemListActivity.class));
			}
		});
		findViewById(R.id.details).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				TaskStackBuilder tsb = TaskStackBuilder.create(getApplicationContext());
				tsb.addNextIntent(new Intent(getApplicationContext(), GoodevItemListActivity.class));
				Intent detailIntent = new Intent(getApplicationContext(), GoodevItemDetailActivity.class);
				detailIntent.putExtra(GoodevItemDetailFragment.ARG_ITEM_ID, "1");
				tsb.addNextIntent(detailIntent);
				tsb.startActivities();
			}
		});
	}

	@Override
	public void onPrepareNavigateUpTaskStack(TaskStackBuilder builder) {
		super.onPrepareNavigateUpTaskStack(builder);
	}
	
}
